Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@syncfusion/ej2-data
Advanced tools
@syncfusion/ej2-data is a data management package that provides a set of utilities for handling data operations such as sorting, filtering, grouping, and querying. It is part of the Syncfusion Essential JS 2 suite and is designed to work seamlessly with other Syncfusion components.
DataManager
The DataManager feature allows you to manage and manipulate data collections. In this example, a DataManager instance is created with a sample data array, and a query is executed to filter out records where the age is greater than 28.
const { DataManager, Query } = require('@syncfusion/ej2-data');
const data = [
{ id: 1, name: 'John', age: 30 },
{ id: 2, name: 'Jane', age: 25 },
{ id: 3, name: 'Doe', age: 35 }
];
const dataManager = new DataManager(data);
const query = new Query().where('age', 'greaterThan', 28);
const result = dataManager.executeLocal(query);
console.log(result);
Sorting
The Sorting feature allows you to sort data collections based on specified fields. In this example, the data is sorted by the 'name' field in ascending order.
const { DataManager, Query } = require('@syncfusion/ej2-data');
const data = [
{ id: 1, name: 'John', age: 30 },
{ id: 2, name: 'Jane', age: 25 },
{ id: 3, name: 'Doe', age: 35 }
];
const dataManager = new DataManager(data);
const query = new Query().sortBy('name', 'ascending');
const result = dataManager.executeLocal(query);
console.log(result);
Grouping
The Grouping feature allows you to group data collections based on specified fields. In this example, the data is grouped by the 'group' field.
const { DataManager, Query } = require('@syncfusion/ej2-data');
const data = [
{ id: 1, name: 'John', age: 30, group: 'A' },
{ id: 2, name: 'Jane', age: 25, group: 'B' },
{ id: 3, name: 'Doe', age: 35, group: 'A' }
];
const dataManager = new DataManager(data);
const query = new Query().group('group');
const result = dataManager.executeLocal(query);
console.log(result);
Aggregates
The Aggregates feature allows you to perform aggregate operations like sum, average, min, and max on data collections. In this example, the sum of the 'age' field is calculated.
const { DataManager, Query, DataUtil } = require('@syncfusion/ej2-data');
const data = [
{ id: 1, name: 'John', age: 30 },
{ id: 2, name: 'Jane', age: 25 },
{ id: 3, name: 'Doe', age: 35 }
];
const dataManager = new DataManager(data);
const query = new Query().select(['age']);
const result = dataManager.executeLocal(query);
const totalAge = DataUtil.aggregates.sum(result, 'age');
console.log(totalAge);
Lodash is a popular utility library that provides a wide range of functions for manipulating arrays, objects, and other data types. It offers similar functionalities to @syncfusion/ej2-data, such as sorting, filtering, and aggregating data. However, Lodash is more general-purpose and not specifically designed for integration with UI components.
Underscore is another utility library that provides functional programming helpers for working with arrays, objects, and other data types. Like Lodash, it offers functionalities similar to @syncfusion/ej2-data, including sorting, filtering, and grouping. Underscore is known for its simplicity and ease of use.
RxDB is a real-time NoSQL database for JavaScript applications. It provides data management capabilities, including querying, sorting, and filtering, similar to @syncfusion/ej2-data. RxDB is designed for offline-first applications and supports real-time data synchronization.
@syncfusion/ej2-data
is a data management package to perform data operations such as grouping, sorting in client applications.
It will act as an abstraction for using local data sources like array of JavaScript objects
and remote data sources like web services returning JSON, JSONP, oData or XML.
Check the changelog here
FAQs
Essential JS 2 DataManager
The npm package @syncfusion/ej2-data receives a total of 98,853 weekly downloads. As such, @syncfusion/ej2-data popularity was classified as popular.
We found that @syncfusion/ej2-data demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.